In recent years, a non-volatile memory which is a data re-writable semiconductor device has been widely used. In a typical non-volatile memory, data is stored by accumulating electric charges in a charge accumulation layer of a transistor included in a memory cell. There are a floating gate type non-volatile memory which uses a floating gate as a charge accumulation layer and a silicon oxide nitride oxide silicon (SONOS) type non-volatile memory which accumulates electric charges in a trap layer including an insulation film of a nitride silicon layer and such.
Reading out data from the non-volatile memory is carried out by the comparison of a reference level and the level of a memory cell. As for the reference level, an average level of a first reference cell in a level of data 0 and of a second reference cell in a level of data 1 is used as the reference level.
As with an SONOS type flash memory, in a non-volatile memory which uses an insulation film as a charge accumulation layer, when repeatedly writing or erasing a memory cell, a charge loss or a charge gain caused by being left standing after writing or erasing becomes large, and a phenomenon of changes in level of the memory cell occurs. Therefore, as disclosed in Japanese Patent Application Publication No. JP-A-2003-257188, a method using a dynamic reference cell which has the same writing and erasing history as a memory cell in a memory cell array as a reference cell has been used.